package com.server.crypto.digest;

import com.server.crypto.Crypto;
import com.server.crypto.CryptoException;

import java.io.InputStream;
import java.io.OutputStream;


/**
 * <p/>
 * <li>@author: XiaJunJian </li>
 * <li>@date: 2020-06-12 17:20:21</li>
 */
public abstract class AbstractDigestCrypto implements Crypto {
    @Override
    final public byte[] decrypt(byte[] src) {
        unsupported();
        return null;
    }

    @Override
    final public String decrypt(String src){
        unsupported();
        return null;
    }

    @Override
    final public String decrypt(String src, String charset) {
        unsupported();
        return null;
    }

    @Override
    final public void decrypt(InputStream in, OutputStream out) {
        unsupported();
    }
    private void unsupported(){
        throw new CryptoException(new UnsupportedOperationException("摘要算法不支持解密，单向的"));
    }
}
